package com.example.zhc36.keymanager.Daopwd;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;


import com.example.zhc36.keymanager.Sqlhoper;
import com.example.zhc36.keymanager.bean.Daomoli;

import java.util.ArrayList;
import java.util.List;

public class Dao {


    private final Sqlhoper lite;

    public Dao(Context ctx) {
        lite = new Sqlhoper(ctx);

    }



   public List<Daomoli> getall(Integer _id) {
        List<Daomoli> list=new ArrayList<>();
        Daomoli pp=null;
        SQLiteDatabase wd=lite.getReadableDatabase();
        Cursor css = wd.rawQuery("select * from moli", null);
        while(css.moveToNext()){
            pp=new Daomoli();
            pp.set_id(css.getInt(0));
            pp.setAddress(css.getString(1));
            pp.setRoom(css.getString(2));
            pp.setDate(css.getString(3));

            list.add(pp);

        }css.close();
        return  list;
   }
}
